<template>
  <div>
    <h3>子组件</h3>
    <p>使用数据项：{{ age }}</p>
    <p>使用方法：{{ aa }}</p>
    <button @click="updateAge(2)">让age+2</button>
    <button @click="updateAgeAfter3s(1)">3秒后+1</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapGetters, mapActions } from 'vuex'
export default {
  computed: {
    ...mapState('user', ['age']),
    ...mapGetters('user', ['aa'])
  },
  methods: {
    ...mapMutations('user', ['updateAge']),
    ...mapActions('user', ['updateAgeAfter3s'])
  }
}
</script>

<style scoped></style>
